package com.xt.partjobback.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xt.partjobback.entity.Classify;
import com.xt.partjobback.mapper.ClassifyMapper;
import com.xt.partjobback.service.ClassIfyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author leotong
 */
@Service
public class ClassifyServiceImpl extends ServiceImpl<ClassifyMapper, Classify> implements ClassIfyService {

    private final ClassifyMapper classifyMapper;

    @Autowired
    public ClassifyServiceImpl(ClassifyMapper classifyMapper) {
        this.classifyMapper = classifyMapper;
    }

    @Override
    public Page<Classify> getClassify(Classify classify) {
        Page<Classify> page=new Page<>(classify.pageNum==null?1: classify.getPageNum(),classify.pageSize==null?5: classify.getPageSize());
        QueryWrapper<Classify> queryWrapper=new QueryWrapper<>();
        if (classify.getName()!=null){
            queryWrapper.like("name",classify.getName());
        }
        return classifyMapper.selectPage(page, queryWrapper);
    }
}
